<template>
  <!-- 底部部分 -->
  <footer class="footer">
    <span class="todo-count">
      <strong>{{ sum }}</strong>
      剩余</span
    >

    <ul class="filters">
      <li>
        <a
          href="#/"
          :class="{ selected: type === 'all' }"
          @click="TypeAdd('all')"
          >全部</a
        >
      </li>
      <li>
        <a
          href="#/active"
          :class="{ selected: type === 'active' }"
          @click="TypeAdd('active')"
          >进行中</a
        >
      </li>
      <li>
        <a
          href="#/completed"
          :class="{ selected: type === 'completed' }"
          @click="TypeAdd('completed')"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" v-show="clearBtn" @click="delAll">
      清除已完成
    </button>
  </footer>
</template>

<script>
export default {
  name: 'TodoFooter',
  props: {
    sum: {
      type: Number,
      require: true,
    },
    clearBtn: {
      type: Boolean,
      require: true,
    },
    type: {
      type: String,
      require: true,
    },
  },
  data() {
    return {}
  },
  methods: {
    delAll() {
      this.$emit('delAll')
    },
    TypeAdd(value) {
      this.$emit('typeAdd', value)
    },
  },
}
</script>

<style scoped></style>
